<template>
	<view :data-theme="theme" class="container">
		<view class="header">
			<!-- 标签页 -->
			<uni-section>
				<view class="uni-padding-wrap uni-common-mt">
					<uni-segmented-control :current="current" :values="items" :style-type="styleType"
						:active-color="bgColor" @clickItem="onClickItem" />
				</view>
			</uni-section>
		</view>
		<view class="content" style="border-radius: 10rpx;margin: 20rpx;">
			<!-- 这里是可滚动的内容 -->
			<scroll-view class="scroll-view" scroll-y>
				<!-- 内容区域 -->
				<view class="scroll-view-inner" style="border-radius: 10px;background-color: #fff;"
					v-for="(item,indexO) in contactData">
					<h2>{{ item.contacts }}</h2>
					<view class="stockOrder">
						<view class="businessStock">
							<view class="top_right" style="padding-left: 20rpx;">
								<view style="margin-bottom: 10rpx;" class="mb_10">负责城市： <span>{{ item.city }}</span>
								</view>
								<view style="margin-bottom: 10rpx;" class="mb_10">联系人： <span>{{ item.name }}</span>
								</view>
								<view style="margin-bottom: 10rpx;" class="mb_10">联系电话：
									<span>{{ item.telephone }}</span>
								</view>
								<view style="margin-bottom: 10rpx;" class="mb_10">联系邮箱： <span>{{ item.email }}</span>
								</view>
							</view>
							<view style="width: 50px;">
								<button type="primary">删除</button>
								<button type="primary">修改</button>
							</view>
						</view>
						<view style="margin:20rpx;border-bottom: 1px solid #f6f6f6"></view>
					</view>
				</view>
				<view style="margin:0 20rpx 20rpx 20rpx;flex: 1;">
					<!-- <u-button type="primary" :color="bgColor" :plain="true" text="+ 新增生产发货地址"
						></u-button> -->
					<button :color="bgColor" class="plain_bgColor"
						style="font-weight: bold;border-radius: 16rpx;color: #FFF;padding: 20rpx;">+ 新增生产发货地址</button>
				</view>
			</scroll-view>
		</view>

		<view class="footer">
			<view style="margin:0 20rpx 20rpx 20rpx;">
				<!-- <u-button :color="bgColor" text="更新保存" style="color: #fff;" @click="saveContacts()"></u-button> -->
				<button :color="bgColor" class="bg_color"
					style="font-weight: bold;border-radius: 16rpx;color: #FFF;padding: 20rpx;"
					@click="saveContacts()">更新保存</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		setThemeColor
	} from '@/utils/setTheme.js'
	let app = getApp();
	import UniSection from '@/components/uni/uni-swipe-action/uni-swipe-action.vue';
	export default {
		components: {
			'uni-section': UniSection
		},
		data() {
			return {
				theme: app.globalData.theme,
				items: ['经营地址', '生产发货地址'],
				current: 0,
				styleType: 'text', //切换按钮
				contactData: [],
			};
		},
		onLoad() {
			this.bgColor = setThemeColor();
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: this.bgColor,
			});
		},
		methods: {
			//标签切换
			onClickItem(e) {
				// if (this.current !== e.currentIndex) {
				// 	this.current = e.currentIndex
				// }
				// if (e.currentIndex == 0) {
				// 	this.tableForm.consignPreSale = 0;
				// 	this.getList();
				// }
				// if (e.currentIndex == 1) {
				// 	this.tableForm.consignPreSale = 1;
				// 	this.getList();
				// }
				console.log(e)
			},
		},
	}
</script>

<style lang="scss">
	.bg_color {
		@include main_bg_color(theme);
	}

	.plain_bgColor {
		@include main_color(theme);
		@include main_bg_rgba_color(theme, 0.05);
		border: 1rpx solid;
	}

	h1 {
		font-weight: bold;
		font-size: 20px;
		margin-bottom: 20px;
	}

	h2 {
		font-weight: bold;
		margin: 20px;
		padding-top: 20rpx;
	}

	page {
		height: 100%;
	}

	.container {
		display: flex;
		flex-direction: column;
		height: 100%;
	}

	.businessStock {
		display: flex;
		flex-flow: row;
		padding: 20rpx;

		.top_right {
			margin-left: 20rpx;
		}
	}

	// .header {
	// 	// height: 100px;
	// 	// background-color: #fff;
	// }

	.content {
		flex: 1;
		overflow: hidden;
	}

	.scroll-view {
		height: 100%;
		padding-bottom: 180rpx;
	}

	.footer {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background-color: #fff;
		padding: 20rpx 0;
		// display: flex;
		justify-content: space-between;
		text-align: center;
		justify-items: center;
	}
</style>